/*
 * NativeTestFactory.h  0.4.0 / Nov 5, 2010
 *
 * Copyright (c) 2010 - 2011, cute4j.com and contributors.
 *
 * This software is licensed under the LGPL version 2.1 license.
 * A copy of this license is included in the file LICENSE-LGPL.txt.
 */
#ifndef NATIVETESTFACTORY_H
#define NATIVETESTFACTORY_H

#ifdef CUTE4J_TEST

#include "NativeTest.h"

// AbstractNativeTestFactory Class. --------------------------------------------

/*!
 * \brief Abstract Native Test Factory.
 *
 * \author Slobodan Vrkacevic
 * \version 0.4.0
 */
class CUTE4J_EXPORT AbstractNativeTestFactory
{
protected:
  inline AbstractNativeTestFactory(const QString &name);
public:
  inline QString name() const;
public:
  virtual NativeTest *createNativeTest() = 0;
private:
  QString m_name;
};

// AbstractNativeTestFactory :: Protected Inline Constructor. ------------------

/*!
 * \brief Constructs new abstract native test factory.
 *
 * \name the name of the test factory
 */
inline AbstractNativeTestFactory::AbstractNativeTestFactory(const QString &name)
  : m_name(name)
{
  // empty constructor body
}

// AbstractNativeTestFactory :: Public Inline Member Function. -----------------

/*!
 * \brief Returns the name of the test factory.
 *
 * \return the name of the test factory
 */
inline QString AbstractNativeTestFactory::name() const
{
  return m_name;
}

/*!
 * \brief Native Test Factory.
 *
 * \author Slobodan Vrkacevic (slobodan.vrkacevic@gmail.com)
 * \version 0.2.0
 */
template<class T>
class CUTE4J_EXPORT NativeTestFactory : public AbstractNativeTestFactory
{
public:
  NativeTestFactory(const QString &name) : AbstractNativeTestFactory(name) {
    // empty constructor body
  }
public:
  virtual NativeTest *createNativeTest() {
    return new T();
  }
};

#endif // CUTE4J_TEST

#endif // NATIVETESTFACTORY_H
